    /********************************************************/
    /*                                                      */
    /*                                                      */
    /*         Copyright (C), 1993  SEIKO EPSON Corp.       */
    /*         ALL RIGHTS RESERVED                          */
    /*                                                      */
    /*                                                      */
    /*  file name : putc.c                                  */
    /*                                                      */
    /*  Revision history                                    */
    /*      93/12/17    first release       S.Akaiwa        */
    /*      97/3/17	modified	    T.Katahira	    */
    /*			change function declaration	    */
    /*					to the ANSI style   */
    /*                                                      */
    /********************************************************/

#ifdef  UNIX
#include    "stdio.h"
#else
#include    <stdio.h>
#endif

int
putc(int iDat, FILE * fiStrmP)

    /********************************************************/
    /*                                                      */
    /*  The putc function writes a single character to      */
    /*  stream pointed to by fiStrmP.                       */
    /*  If stdout or stderr is not specified by fiStrmP,    */
    /*  the putc function returns EOF.                      */
    /*                                                      */
    /*      RETURN  Except EOF  ... The character written   */
    /*              EOF         ... Error                   */
    /*                                                      */
    /*  <ANSI>                                              */
    /*      The putc function writes a single character to  */
    /*      user specified stream.                          */
    /*                                                      */
    /*      RETURN  Except EOF  ... The character written   */
    /*              EOF         ... Error                   */
    /*                                                      */
    /********************************************************/

    /* int     iDat    ;            character to be written */
    /* FILE    *fiStrmP;           pointer to target stream */
    {

     unsigned char  ucDat;

     if((fiStrmP != stdout) && (fiStrmP != stderr)){
        return  (int)EOF;                 /* illegal stream */
     }
     
     ucDat = (unsigned char)iDat;
     if(write(fiStrmP->_fd, (char*)&ucDat, 1) < 1){
        return  (int)EOF;                    /* write error */
     }

     return (int)iDat;          /* return written character */
    }

